/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ManageBean;

import HouseBN.HouseService;
import entity.House;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

/**
 *
 * @author Mr-Quick
 */
@ManagedBean
@ViewScoped
public class SearchMB {

    Date datefrom;
    Date dateto;
    String homestyle;
    String typehouse;
    String city;
    String location;
    int pricefrom;
    int priceto;
    private List<entity.House> houseList;

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public Date getDatefrom() {
        return datefrom;
    }

    public void setDatefrom(Date datefrom) {
        this.datefrom = datefrom;
    }

    public Date getDateto() {
        return dateto;
    }

    public void setDateto(Date dateto) {
        this.dateto = dateto;
    }

    public String getHomestyle() {
        return homestyle;
    }

    public void setHomestyle(String homestyle) {
        this.homestyle = homestyle;
    }

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    public int getPricefrom() {
        return pricefrom;
    }

    public void setPricefrom(int pricefrom) {
        this.pricefrom = pricefrom;
    }

    public int getPriceto() {
        return priceto;
    }

    public void setPriceto(int priceto) {
        this.priceto = priceto;
    }

    public String getTypehouse() {
        return typehouse;
    }

    public void setTypehouse(String typehouse) {
        this.typehouse = typehouse;
    }

    public List<House> getHouseList() {
        return houseList;
    }

    public SearchMB() {
        Calendar cal = Calendar.getInstance();
        cal.setTime(new java.util.Date());
        cal.add(Calendar.DATE, -7);
        datefrom = cal.getTime();
        dateto = new java.util.Date();
    }

    public String search() {
        HouseService service = new HouseService();
        houseList = service.search(datefrom, dateto, homestyle, typehouse, city, location, pricefrom, priceto);
        return null;
    }
}
